package com.xncoding.pos.feign;

import com.xncoding.pos.common.enums.ResultStatusEnum;
import com.xncoding.pos.common.model.ResultGenerator;
import com.xncoding.pos.common.model.ResultModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 熔断时候响应的消息
 *
 * @Author guoyb
 * @Date 2020/3/31  16:16
 */
@Component
@Slf4j
public class MessFeignServiceFallBack implements MessFeignService {

    //todo 断路器
    //feign.hystrix.enabled: true
    // 如果超过hystrix处理时间会直接抛出hystrix的异常：


    @Override
    public ResultModel verification() {
        log.error("------fegin熔断异常-----");
        return ResultGenerator.genEnumResult(ResultStatusEnum.CALL_ERROR);
    }

    @Override
    public ResultModel getUser(String userId, Integer sleepSeconds) {
        return ResultGenerator.genEnumResult(ResultStatusEnum.CALL_ERROR);
    }
}

